<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"
	dir="ltr">
<head>
<title>Moment Mobile Payments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/styles/layout.css" type="text/css" />
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script>
	$(function() {
		$('.office-title').click(function() {
			$(this).next('div').slideToggle();

			$(this).parent().siblings().children().next().slideUp();
			return false;
		});
		/**** new code ***/

	});
</script>
</head>
<body id="top">
		<%@page import="com.moment.webservice.*"%>
	<%@page import="com.moment.util.Converter"%>
	<%@page import="java.util.HashMap"%>
	<%@page import="java.util.Map"%>
	<%@include file="loggedinheader.jsp"%>
	<%@ page import="org.json.*"%>
	<%@ page import="com.moment.model.*"%>
	<%!String s[];%>
	<%
		System.out.println("Session name:="
			+ session.getAttribute("username"));
			if ((session.getAttribute("username") == null)
			|| (session.getAttribute("username") == "")) {
	%>
	You are not logged in
	<br />
	<a href="index.jsp">Please Login</a>
	<%
		} else {
		String error=(String)session.getAttribute("error");
		System.out.println("Error="+error);
		if(error!=null && !error.equalsIgnoreCase("null")){
	%>
	<div class="alert-box error">
		<span>error: </span><%=error%>
	</div>
	<%
		session.setAttribute("error", null);
		}
			}
	%>


	<jsp:useBean id="userObj" class="com.moment.model.UserReg"
		scope="session" />
	<div class="wrapper col3">

		<div id="intro">
			<div id="logout">
				<a href="/MMP/LogoutController"><img src="images/logout.png"
					alt="Logout" /></a>
			</div>
			<div class="fl_left1">

				<div id="login1">
					<div class="imgl">
						<img alt="Embedded Image" height="128" width="128"
							src="data:image/jpeg;base64,<jsp:getProperty name="userObj" property="imagestr" />" />
					</div>
				</div>
				<div id="instrumentsmain">
					<div>
						<center>
							<h2>View Location</h2>
						</center>

					</div>


					<div class="slide-toggle">
						<%
						//--New CODE-------------
						Map<String, String> map = new HashMap<String, String>();
						map.put("method", "17");
						map.put("mnum", (String) session.getAttribute("username"));

						String json = new Converter().mapToJson(map);
						System.out.println("json String :" + json);
						Services serviceproxy = new ServicesProxy();

						String location = serviceproxy.service(json);
						// ---------------------------
							/* WebsProxy ws = new WebsProxy();
						String mnumber = (String)session.getAttribute("username");
						String location = ws.fetchLocation(mnumber); */
						LocationData locationData=new LocationData();
						locationData.setLocationlist(location);
										String[] location_details = locationData.getLocationlist().split("-");
										for(String s:location_details)
										{
						%>
						<div class="office-row">
							<h3 class="office-title"><%=s%></h3>
							<div class="office">
								<div class="instruinner">
									<a href='javascript:void(0);' id='view' onclick="viewlocation('<%=s%>')">View</a>
								</div>

							</div>
						</div>
						<%
							}
						%>

					</div>
				</div>
			</div>
			<br class="clear" />
		</div>
		<%@include file="footer.jsp"%>
	</div>

	<script>
		function viewlocation(lname) {
			//alert(id);
			$("#lname").val(lname);
			$("form#location").submit();
		}

	</script>

	<form id="location" name="locationForm"
		action="../LocationController" method="post">
		<input type="hidden" name="lname" id="lname" />
		<input type="hidden" name="ltype" id="ltype" value="view"/>
	</form>

</body>
</html>

